<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #id1{   width: 200px;  height: 100px; background-color: aqua;}
        #id2{   width: 200px;  height: 300px; background-color:blueviolet;}
    </style>
    <script>
        function $(id){
            return document.getElementById(id)
        }
        window.onload = function(){
            var oDiv1 = $(oDiv1)
            var oDiv2 = $(oDiv2)
            var oInput1 = $(oInput1)

            var aBtns = document.getElementsByTagName("button")

            aBtns[0].onclick = function(){
                if(!oInput1.value){
                    alert("输入内容不允许为空！")
                }else{
                    var newDiv = document.createElement("div")
                    var oText = document.createTextNode(oInput1.value)

                    newDiv.appendChild(oText)
                }
            }
        }
    </script>
</head>
<body>
    <div id = "id1">
        <input type="text" id = "input1" placeholder="输入内容">
        <button id = "btn1" >增加</button>
        <button id = "btn2">复制</button>
        <button id = "btn3">删除</button>
    </div>
    <div id = "id2">
        
    </div>
</body>
</html>